package com.llg.controller;

import com.llg.model.ComputeModel;
import com.llg.model.response.DataResult;
import com.llg.pojo.ReceiveSpec;
import com.llg.pojo.SupplySpec;
import com.llg.service.ComputeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/compute")
public class ComputeController {


    @Autowired
    private ComputeService computeService;

    /**
    * @Description: 通过面积计算
    * @param:  specId:型号id
    * @param:  area:面积
    * @param:  mode:计算方式，1=16:9  2=4:3
    * @Author:         llg
    * @CreateDate:     2020/3/18 20:01
    */
    @GetMapping("/computeByArea")
    public DataResult<ComputeModel> computeByArea(Integer specId,Double area,Integer mode){
        return computeService.computeByArea(specId, area, mode);
    }

    /**
    * @Description:  通过宽高计算
    * @param:  specId:型号id
    * @param:  width:宽
    * @param:  height:高
    * @param:  mode:计算方式，1=16:9  2=4:3
    * @Author:         llg
    * @CreateDate:     2020/3/18 20:06
    */
    @GetMapping("/computeByLong")
    public DataResult<ComputeModel> computeByLong(Integer specId,Double width,Double height,Integer mode){
        return computeService.computeByLong(specId, width, height, mode);
    }

    /**
    * @Description:  根据单元板总数和电源型号id计算需要多少个电源
    * @param:  num:单元板总数
    * @param:  lid:led型号id
    * @param:  sid:电源型号id
    * @Author:         llg
    * @CreateDate:     2020/3/19 21:35
    */
    @GetMapping("/computeSupplyNum")
    public DataResult<SupplySpec> computeSupplyNum(Integer num, Integer lid, Integer sid){
        return computeService.computeSupplyNum(num,lid,sid);
    }

    /**
    * @Description:   计算接收卡张数
     * @param:      densityRatio：屏幕像素比
     * @param:      lid:led的id
     * @param:      rid:接收卡id
    * @Author:         llg
    * @CreateDate:     2020/3/23 16:38
    */
    @GetMapping("/computeReceiveNum")
    public DataResult<ReceiveSpec> computeReceiveNum(String densityRatio,int lid,int rid){
        return computeService.computeReceiveNum(densityRatio, lid, rid);
    }
}
